package com.bosssoft.rbac.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author MaYunFei
 * @ProjectName boss-rbac
 * @Description TODO
 * @time 2022/7/4 12:57
 */
@RestController
public class UserInfoController {

    /*
    * 当前登录的用户对象
    * */
    @GetMapping("/user/info")
    public Principal userInfo(Principal principal) {
        // 使用ThreadLocal来实现的
        //Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

        return principal;
    }
}
